package org.osoftware.mumi.dao.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The Class Specialist.
 */
@Entity
@Table(name="specialist")
public class Specialist extends Person{

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = 6499035374545138415L;
	
	/** The speciality. */
	@ManyToOne
	@JoinColumn(name = "speciality_id")
	private Speciality speciality;
	
	/** The skills. */
	@OneToMany
	private List<Skill> skills;
	
	/** The titles. */
	@OneToMany(cascade = CascadeType.ALL)
	@JoinColumn(name = "specialist_id", updatable = false, insertable = false, nullable=false)
	private List<SpecialistTitle> titles;
	
	/** The titles. */
	@OneToMany(cascade = CascadeType.ALL)
	@JoinColumn(name = "specialist_id", updatable = false, insertable = false)
	private List<AttentionTime> assignedAttentionTimes;	
	

	
	/**
	 * Gets the assigned attention times.
	 *
	 * @return the assigned attention times
	 */
	public List<AttentionTime> getAssignedAttentionTimes() {
		return assignedAttentionTimes;
	}

	/**
	 * Sets the assigned attention times.
	 *
	 * @param assignedAttentionTimes the new assigned attention times
	 */
	public void setAssignedAttentionTimes(List<AttentionTime> assignedAttentionTimes) {
		this.assignedAttentionTimes = assignedAttentionTimes;
	}

	/**
	 * Gets the speciality.
	 *
	 * @return the speciality
	 */
	public Speciality getSpeciality() {
		return speciality;
	}
	
	/**
	 * Sets the speciality.
	 *
	 * @param speciality the new speciality
	 */
	public void setSpeciality(Speciality speciality) {
		this.speciality = speciality;
	}
	
	/**
	 * Gets the skills.
	 *
	 * @return the skills
	 */
	public List<Skill> getSkills() {
		return skills;
	}
	
	/**
	 * Sets the skills.
	 *
	 * @param skills the new skills
	 */
	public void setSkills(List<Skill> skills) {
		this.skills = skills;
	}
	
	/**
	 * Gets the titles.
	 *
	 * @return the titles
	 */
	public List<SpecialistTitle> getTitles() {
		return titles;
	}
	
	/**
	 * Sets the titles.
	 *
	 * @param titles the new titles
	 */
	public void setTitles(List<SpecialistTitle> titles) {
		this.titles = titles;
	}

	/* (non-Javadoc)
	 * @see org.osoftware.mumi.dao.model.Person#toString()
	 */
	@Override
	public String toString() {
		return "Specialist [speciality=" + (speciality != null? speciality.getName():"NONE") + ", skills=" + skills
				+ ", titles=" + titles + ", toString()=" + super.toString()
				+ "]";
	}
	
	
}
